//
//  ZGLPicVCButtonView.m
//  Faker
//
//  Created by dllo on 15/11/6.
//  Copyright © 2015年 dllo. All rights reserved.
//

#import "ZGLPicVCButtonView.h"

@implementation ZGLPicVCButtonView


- (instancetype)initWithFrame:(CGRect)frame {
    self = [super initWithFrame:frame];
    if (self) {
        for (NSInteger i = 0; i < 4; i++) {
            UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
            [self addSubview:button];
        }
    }
    return self;
}
- (void)layoutSubviews {
    NSArray *nameArr = @[@"万花筒", @"竞技台", @"声色圈", @"型物志"];
    NSArray *picArr = @[@"wanhuatong", @"huizhang", @"quan", @"qiwu"];
    for (NSInteger i = 0; i < 4; i++) {
        UIButton *button = self.subviews[i];
        [button setFrame:CGRectMake(0 + self.frame.size.width / 4 * i, 0, self.frame.size.width / 4, self.frame.size.height)];
        if (0 == i) {
            [button setBackgroundColor:[UIColor colorWithRed:0.261 green:0.342 blue:1.000 alpha:1.000]];
        }
        button.titleLabel.font = [UIFont systemFontOfSize:11];
        button.imageEdgeInsets = UIEdgeInsetsMake(-7,   18, 7, -18);
        button.titleEdgeInsets = UIEdgeInsetsMake(12, - 9, - 12, 9);
        [button setTitle:nameArr[i] forState:(UIControlStateNormal)];
        [button setImage:[UIImage imageNamed:picArr[i]] forState:(UIControlStateNormal)];
    }
}

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
